# -*- coding: utf-8 -*-
"""
 @Time    : 2021/2/22 下午5:46
 @Author  : tgy
 
"""


def sort(stack:list):
    ...
    if not stack or len(stack) <= 1:
        return

    help = []

    while len(stack):
        ...
        val = stack.pop()
        while len(help) and val > help[-1]:
            ...
            stack.append(help.pop())
        help.append(val)

    help.reverse()
    for val in help:
        stack.append(val)


if __name__ == '__main__':
    ...
    stack = [3, 2,0, 4, 1, 5]
    sort(stack)
    print(stack)